package my.test.groups.common;

import java.util.ArrayList;

/**
 * @Author 许玉康
 * @Date 2019/9/5 14:48
 */
public class Root implements IRoot {

    //保存跟节点下的树枝节点和树叶节点，Subordinate的意思是下级
    private ArrayList<Object> subordinate = new ArrayList<>();

    //根节点的名称
    private String name = "";
    //根节点的职位
    private String position = "";
    //根节点的薪水
    private int salary = 0;

    public Root(String name, String position, int salary) {
        this.name = name;
        this.position = position;
        this.salary = salary;
    }

    @Override
    public String getInfo() {
        return this.name + this.position + this.salary;
    }

    @Override
    public void add(IBranch branch) {
        this.subordinate.add(branch);
    }

    @Override
    public void add(ILeaf leaf) {
        this.subordinate.add(leaf);
    }

    @Override
    public ArrayList<Object> getSubordinateInfo() {
        return this.subordinate;
    }
}
